#!/bin/bash

CUR_PATH=$(pwd)

DST_4212_PATH=$CUR_PATH/../img/
DST_4412_PATH=$CUR_PATH/../img_4412/

DST_PATH=$CUR_PATH/../img

OUT_PATH=$CUR_PATH


function  make_4212_img()
{
    make clean
    #make distclean
    make smdk4212_config
    make -j13	
    . mksduboot_scp4212.sh
}

function  make_4412_img()
{
    make clean
    #make distclean
    make smdk4412_config
    make -j13	
    . mksduboot_scp4412.sh
}


function  copy_4212_img()
{
    cp $OUT_PATH/bootloader_sd.vhd $DST_4212_PATH/ -f
    cp $OUT_PATH/bootloader_mmc.bin $DST_4212_PATH/ -f
}

function  copy_4412_img()
{
    cp $OUT_PATH/bootloader_sd.vhd $DST_4412_PATH/ -f
    cp $OUT_PATH/bootloader_mmc.bin $DST_4412_PATH/ -f
}


mkdir $DST_4212_PATH -p
mkdir $DST_4412_PATH -p

case $1 in

    all )
        make_4412_img
        copy_4412_img  

#        make_4212_img
#        copy_4212_img
        ;;


    4212 )
        make_4212_img
        ;;

    4412 )
        make_4412_img
        ;;      

    copy42* )
	copy_4212_img
        ;;

    copy44* )
	copy_4412_img
        ;;

    * )
        make smdk4412_config
        make -j12
        . mksduboot_scp4412.sh
        ;;
esac	    


echo "####### Do ..  [$1] OK !!###########"

